import { request } from "@/utils/service"

export interface IPhotoGallery {
  id?: number
  photoArea: number
  photoUri: string
  scenicName: string
  scenicProvince: string
  scenicCity: string
}

export interface ICreatePhotoDataApi {
  photoArea: number
  photoUri: string
  official: boolean
}
export interface IBatchCreatePhotoDataApi {
  photoArea: number
  photoUri: string
  photoUris: Array<string>
  official: boolean
}

export interface IGetPhotoListDataApi {
  scenicName?: string
  scenicProvince?: string
  pageNum: number
  pageSize: number
}

export function createPhoto(data: ICreatePhotoDataApi) {
  return request({
    url: "/travel/manage/photo/create",
    method: "post",
    data
  })
}

export function batchCreatePhoto(data: IBatchCreatePhotoDataApi) {
  return request({
    url: "/travel/manage/photo/create/batch",
    method: "post",
    data
  })
}

export function getPhotoList(params: IGetPhotoListDataApi) {
  return request({
    url: "/travel/manage/photo/official/list",
    method: "get",
    params
  })
}
export function updatePhoto(id: number, data: ICreatePhotoDataApi) {
  return request({
    url: "/travel/manage/photo/update/" + id,
    method: "post",
    data
  })
}

export function deletePhoto(id: number) {
  return request({
    url: "/travel/manage/photo/official/delete/" + id,
    method: "delete"
  })
}

export function uploadPhoto(data: any) {
  return request({
    url: "/travel/manage/photo/upload",
    method: "post",
    headers: {
      "Content-Type": ""
    },
    data
  })
}
